﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Helper;

namespace JustTest
{
    public partial class StringEnc : System.Web.UI.Page
    {
        const string key = "adfg3sdfsdg903)(0ed9g";
        const string iv = "suggy.com";

        // 인스턴스 만들기.  
        AESEncrypter crypt = new AESEncrypter(key, iv);  

        private string _EcStr;
        private string _DeStr;


        protected void Page_Load(object sender, EventArgs e)
        {

        }

        // #### 암호화 버튼 클릭 #### 시작 ####
        protected void btnEnc_Click(object sender, EventArgs e)
        {
            _EcStr = crypt.Encrypt(txtStr1.Text);   // 암호화를 합니다.
            lblStr1.Text = _EcStr;
            txtStr2.Text = _EcStr;
        }
        // #### 암호화 버튼 클릭 #### 끝 ####

        // #### 복호화 버튼 클릭 #### 시작 ####
        protected void btnDec_Click(object sender, EventArgs e)
        {
            _DeStr = crypt.Decrypt(txtStr2.Text);   // 복호화를 합니다.
            lblStr2.Text = _DeStr;
        }
        // #### 복호화 버튼 클릭 #### 끝 ####
    }
}